package org.noear.solon.boot.netty.http;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.noear.solon.core.handle.Context;
import org.noear.solon.server.ServerProps;
import org.noear.solon.web.servlet.SolonServletHandler;

public class TCHttpContextHandler extends SolonServletHandler {
    @Override
    protected void preHandle(Context ctx) {
        if (ServerProps.output_meta) {
        	//TODO 
//            ctx.headerSet("Solon-Server", TomcatPlugin.solon_server_ver());
        }
    }

    @Override
    protected boolean useLimitStream() {
        return true;
    }

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        if (request.getCharacterEncoding() == null) {
            request.setCharacterEncoding(ServerProps.request_encoding);
        }

        super.service(request, response);
    }
}
